#ifndef FOREST_H
#define FOREST_H
#include "common.h"
#include "string.h"

// for input options
const string OPTION_HELP = "-h";
const string OPTION_GET_HELP = "--help";
const string OPTION_INTERPRET = "-i";
const string OPTION_COMPILE = "-c";
const string OPTION_OUTPUT = "-o";

// forest has two work mode, one is as compiler, another one is as interpreter
enum class FOREST_WORK_MODE : int
{
    COMPILER = 0,
    INTERPRETER
};

// paresd options from input arguments
class Options
{
public:
    Options() : input_file_name_(DEFAULT_OUTPUT_FILE), output_file_name_(DEFAULT_OUTPUT_FILE) {};
    virtual ~Options() = default;
    void SetInputFileName(string input_name)
    {
        input_file_name_ = input_name;
    }
    void SetOutputFileName(string output_name)
    {
        output_file_name_ = output_name;
    }
    void SetWorkMode(FOREST_WORK_MODE mode)
    {
        work_mode_ = mode;
    }
    string GetInputFileName()
    {
        return input_file_name_;
    }
    string GetOutputFileName()
    {
        return output_file_name_;
    }
    FOREST_WORK_MODE GetWorkMode()
    {
        return work_mode_;
    }

private:
    string input_file_name_;
    string output_file_name_;
    FOREST_WORK_MODE work_mode_;
};

// base class of forest
class Forest
{
public:
    Forest();
    Forest(string input_name);
    Forest(string input_name, string output_name);
    virtual ~Forest() = default;
    void SetInputFileName(string input_name);
    void SetOutputFileName(string output_name);
    void SetWorkMode(FOREST_WORK_MODE mode);
    FOREST_WORK_MODE GetWorkMode();
    virtual bool run() {};

protected:
    string input_file_name_;
    string output_file_name_;
    FOREST_WORK_MODE work_mode_;
};
#endif // FOREST_H